﻿@model IEnumerable<WD.Db.Contract.Rbac_User>

@{
    ViewBag.Title = "WD.Db.Contract.Model.Rbac_User_Index";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
    var i = 0;
}

@section Script
{
    <script>
        var id = "Rbac_User";

        //新增按钮配置信息（弹框）
        var option_add = {
            id: id,
            title: "新增用户",
            yesfn: function () {
                var userId = $("#UserID").val();
                var userName = $("#UserName").val();
                if (!userId) {
                    msgerr({ message: "请填写用户帐号！" });
                    return false;
                }
                if (!userName) {
                    msgerr({ message: "请填写用户名！" });
                    return false;
                }
                //AJAX加载过渡动画
                DialogLoading({ id: id }, true);
                //TODO AJAX保存事件开始

                $("#Rbac_User_mainForm").PostForm({
                    vfn: function () { return true; },
                    success: function (data) {
                        msgsuc(data);
                        //关闭窗口
                        CloseDialog(id);
                        ReloadTab();
                    },
                    error: function (data) {
                        msgerr(data);
                    },
                    //隐藏AJAX加载过渡动画
                    complete: DialogLoading({ id: id }, false)
                });
                //TODO AJAX保存事件结束
            },
            yestxt: "保存"
        };
        //
        var setroleid = "SetRoleShow_id";
        var setroletitle = "分配用户角色";
        var option_setrole = {
            id: setroleid,
            title: setroletitle,
            yesfn: function () {

                //AJAX加载过渡动画
                DialogLoading({ id: setroleid }, true);

                SaveRoleNodes(function () {
                    //隐藏AJAX加载过渡动画
                    DialogLoading({ id: setroleid }, false);
                    //关闭窗口
                    CloseDialog(setroleid);
                });
            },
            yestxt: "分配"
        };




    </script>

}

@section ToolbarArea{
    <a href="@Url.Action("Create")" target="edit" data-option='option_add'  class="btn pull-left">
        <i class="fa fa-plus"></i>新增
    </a>
}


@section SearchArea{

}

@section MainTable{
    <table class="table">
        <thead>
            <tr>
                <th class="text-left"><span>序号</span></th>
                <th><a href="#" role="sort" data-field="DepartmentID"><span>用户帐号</span></a></th>
                @*							<th><a href="#" role="sort" data-field="PWD"><span>PWD</span></a></th>*@
                <th><a href="#" role="sort" data-field="UserName"><span>用户名</span></a></th>
                <th><a href="#" role="sort" data-field="LastLoginDate"><span>最近登录时间</span></a></th>
                <th><a href="#" role="sort" data-field="LastLoginIP"><span>最近登录IP</span></a></th>
                @*                <th><a href="#" role="sort" data-field="UserPic"><span>头像</span></a></th>*@
                @*							<th><a href="#" role="sort" data-field="IsDeleted"><span>IsDeleted</span></a></th>*@
                <th><a href="#" role="sort" data-field="EditDate"><span>编辑时间</span></a></th>
                <th><a href="#" role="sort" data-field="EditUser"><span>编辑人</span></a></th>
                <th><a href="#" role="sort" data-field="CreateTime"><span>创建时间</span></a></th>
                <th class="text-right"><span>操作</span></th>


            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                i++;
                <tr>
                    <td>
                        @i
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.UserID)
                    </td>
                    @*						<td>
						@Html.DisplayFor(modelItem => item.PWD)
					</td>*@
                    <td>
                        @Html.DisplayFor(modelItem => item.UserName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.LastLoginDate)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.LastLoginIP)
                    </td>
                    @*                   <td>
                        @Html.DisplayFor(modelItem => item.UserPic)
                    </td>*@
                    @*							<td>
						@Html.DisplayFor(modelItem => item.IsDeleted)
					</td>*@
                    <td>
                        @Html.DisplayFor(modelItem => item.EditDate)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.EditUser)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CreateTime)
                    </td>
                    <td class="text-right">
                        <a href="@Url.Action("SetRole", new { id = item.ID })" class="table-link" target="edit"  data-option='option_setrole' >
                            <span class="fa-stack">
                                <i class="fa fa-square fa-stack-2x"></i>
                                <i class="fa fa-cog fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                        <a href="@Url.Action("Edit", new { id = item.ID })" class="table-link" target="edit" data-option='option_add' >
                            <span class="fa-stack">
                                <i class="fa fa-square fa-stack-2x"></i>
                                <i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                        <a href="@Url.Action("Deleted", new { ids = item.ID })" class="table-link danger" target="ajax" data-reload="true">
                            <span class="fa-stack">
                                <i class="fa fa-square fa-stack-2x"></i>
                                <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>

                    </td>
                </tr>
            }
        </tbody>
    </table>
}


